namespace QMVnSoft.ReportForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormVCD02LViewer : FormReportViewer
    {
        private IContainer components;
        private LabelControl lblMa_Kho;
        private LabelControl lblMa_Nh_Vt;
        private LabelControl lblMa_Vt;
        private LabelControl lblNgay_Ct1;
        private TextSearch txtMa_Kho;
        private TextSearch txtMa_Nh_Vt;
        private TextSearch txtMa_Vt;
        private TextDate txtNgay_Ct1;
        private TextControl txtTen_Kho;
        private TextControl txtTen_Nh_Vt;
        private TextControl txtTen_Vt;

        public FormVCD02LViewer()
        {
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = AppInstance.EndWorkingDate;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormVCD02LViewer));
            this.txtTen_Vt = new QMVnSoft.Controls.TextControl();
            this.txtMa_Vt = new QMVnSoft.Controls.TextSearch();
            this.lblMa_Vt = new QMVnSoft.Controls.LabelControl();
            this.txtNgay_Ct1 = new QMVnSoft.Controls.TextDate();
            this.lblNgay_Ct1 = new QMVnSoft.Controls.LabelControl();
            this.txtTen_Nh_Vt = new QMVnSoft.Controls.TextControl();
            this.txtMa_Nh_Vt = new QMVnSoft.Controls.TextSearch();
            this.lblMa_Nh_Vt = new QMVnSoft.Controls.LabelControl();
            this.txtTen_Kho = new QMVnSoft.Controls.TextControl();
            this.txtMa_Kho = new QMVnSoft.Controls.TextSearch();
            this.lblMa_Kho = new QMVnSoft.Controls.LabelControl();
            this.rptContainer.Panel1.SuspendLayout();
            this.rptContainer.SuspendLayout();
            this.SuspendLayout();
            // 
            // rptContainer
            // 
            // 
            // rptContainer.Panel1
            // 
            this.rptContainer.Panel1.Controls.Add(this.txtTen_Kho);
            this.rptContainer.Panel1.Controls.Add(this.txtMa_Kho);
            this.rptContainer.Panel1.Controls.Add(this.lblMa_Kho);
            this.rptContainer.Panel1.Controls.Add(this.txtTen_Nh_Vt);
            this.rptContainer.Panel1.Controls.Add(this.txtMa_Nh_Vt);
            this.rptContainer.Panel1.Controls.Add(this.lblMa_Nh_Vt);
            this.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.txtTen_Vt);
            this.rptContainer.Panel1.Controls.Add(this.txtMa_Vt);
            this.rptContainer.Panel1.Controls.Add(this.lblMa_Vt);
            this.rptContainer.Size = new System.Drawing.Size(794, 507);
            this.rptContainer.SplitterDistance = 88;
            // 
            // txtTen_Vt
            // 
            this.txtTen_Vt.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Vt.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Vt.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Vt.CheckTextSearched = false;
            this.txtTen_Vt.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Vt.Enabled = false;
            this.txtTen_Vt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Vt.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Vt.Location = new System.Drawing.Point(214, 48);
            this.txtTen_Vt.Name = "txtTen_Vt";
            this.txtTen_Vt.OldValue = null;
            this.txtTen_Vt.Size = new System.Drawing.Size(458, 13);
            this.txtTen_Vt.TabIndex = 5;
            this.txtTen_Vt.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Vt.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Vt.Value = ((object)(resources.GetObject("txtTen_Vt.Value")));
            // 
            // txtMa_Vt
            // 
            this.txtMa_Vt.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Vt.CheckTextSearched = false;
            this.txtMa_Vt.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Vt.EmptyIsValid = true;
            this.txtMa_Vt.FieldDisplay = "Ten_Vt";
            this.txtMa_Vt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Vt.FoundIsValid = true;
            this.txtMa_Vt.Location = new System.Drawing.Point(108, 45);
            this.txtMa_Vt.MaxLength = 32;
            this.txtMa_Vt.Name = "txtMa_Vt";
            this.txtMa_Vt.OldValue = null;
            this.txtMa_Vt.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Vt.TabIndex = 4;
            this.txtMa_Vt.TableName = "DMVT";
            this.txtMa_Vt.TextDisplay = this.txtTen_Vt;
            this.txtMa_Vt.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Vt.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Vt.Value = ((object)(resources.GetObject("txtMa_Vt.Value")));
            // 
            // lblMa_Vt
            // 
            this.lblMa_Vt.AutoSize = true;
            this.lblMa_Vt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Vt.Location = new System.Drawing.Point(12, 48);
            this.lblMa_Vt.Name = "lblMa_Vt";
            this.lblMa_Vt.Size = new System.Drawing.Size(52, 14);
            this.lblMa_Vt.TabIndex = 87;
            this.lblMa_Vt.Text = "Mã vật tư";
            // 
            // txtNgay_Ct1
            // 
            this.txtNgay_Ct1.DateTimeFormat = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct1.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct1.Location = new System.Drawing.Point(108, 66);
            this.txtNgay_Ct1.Mask = "00/00/0000";
            this.txtNgay_Ct1.Name = "txtNgay_Ct1";
            this.txtNgay_Ct1.OldValue = null;
            this.txtNgay_Ct1.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct1.TabIndex = 6;
            this.txtNgay_Ct1.Value = ((object)(resources.GetObject("txtNgay_Ct1.Value")));
            // 
            // lblNgay_Ct1
            // 
            this.lblNgay_Ct1.AutoSize = true;
            this.lblNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct1.Location = new System.Drawing.Point(12, 69);
            this.lblNgay_Ct1.Name = "lblNgay_Ct1";
            this.lblNgay_Ct1.Size = new System.Drawing.Size(54, 14);
            this.lblNgay_Ct1.TabIndex = 98;
            this.lblNgay_Ct1.Text = "Đến ngày";
            // 
            // txtTen_Nh_Vt
            // 
            this.txtTen_Nh_Vt.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Nh_Vt.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Nh_Vt.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Nh_Vt.CheckTextSearched = false;
            this.txtTen_Nh_Vt.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nh_Vt.Enabled = false;
            this.txtTen_Nh_Vt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Nh_Vt.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Nh_Vt.Location = new System.Drawing.Point(214, 27);
            this.txtTen_Nh_Vt.Name = "txtTen_Nh_Vt";
            this.txtTen_Nh_Vt.OldValue = null;
            this.txtTen_Nh_Vt.Size = new System.Drawing.Size(458, 13);
            this.txtTen_Nh_Vt.TabIndex = 3;
            this.txtTen_Nh_Vt.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Nh_Vt.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Nh_Vt.Value = ((object)(resources.GetObject("txtTen_Nh_Vt.Value")));
            // 
            // txtMa_Nh_Vt
            // 
            this.txtMa_Nh_Vt.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Nh_Vt.CheckTextSearched = false;
            this.txtMa_Nh_Vt.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Nh_Vt.EmptyIsValid = true;
            this.txtMa_Nh_Vt.FieldDisplay = "Ten_Nh_Vt";
            this.txtMa_Nh_Vt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Nh_Vt.FoundIsValid = true;
            this.txtMa_Nh_Vt.Location = new System.Drawing.Point(108, 24);
            this.txtMa_Nh_Vt.MaxLength = 32;
            this.txtMa_Nh_Vt.Name = "txtMa_Nh_Vt";
            this.txtMa_Nh_Vt.OldValue = null;
            this.txtMa_Nh_Vt.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Nh_Vt.TabIndex = 2;
            this.txtMa_Nh_Vt.TableName = "DMNHVT";
            this.txtMa_Nh_Vt.TextDisplay = this.txtTen_Nh_Vt;
            this.txtMa_Nh_Vt.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Nh_Vt.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Nh_Vt.Value = ((object)(resources.GetObject("txtMa_Nh_Vt.Value")));
            // 
            // lblMa_Nh_Vt
            // 
            this.lblMa_Nh_Vt.AutoSize = true;
            this.lblMa_Nh_Vt.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Nh_Vt.Location = new System.Drawing.Point(12, 27);
            this.lblMa_Nh_Vt.Name = "lblMa_Nh_Vt";
            this.lblMa_Nh_Vt.Size = new System.Drawing.Size(65, 14);
            this.lblMa_Nh_Vt.TabIndex = 105;
            this.lblMa_Nh_Vt.Text = "Nhóm vật tư";
            // 
            // txtTen_Kho
            // 
            this.txtTen_Kho.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTen_Kho.BackColor = System.Drawing.SystemColors.Control;
            this.txtTen_Kho.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtTen_Kho.CheckTextSearched = false;
            this.txtTen_Kho.DisabledForeColor = System.Drawing.Color.Blue;
            this.txtTen_Kho.Enabled = false;
            this.txtTen_Kho.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtTen_Kho.ForeColor = System.Drawing.Color.Blue;
            this.txtTen_Kho.Location = new System.Drawing.Point(214, 6);
            this.txtTen_Kho.Name = "txtTen_Kho";
            this.txtTen_Kho.OldValue = null;
            this.txtTen_Kho.Size = new System.Drawing.Size(458, 13);
            this.txtTen_Kho.TabIndex = 1;
            this.txtTen_Kho.UserTextLength = QMVnSoft.AppInstance.TextControlLength.None;
            this.txtTen_Kho.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.Right;
            this.txtTen_Kho.Value = ((object)(resources.GetObject("txtTen_Kho.Value")));
            // 
            // txtMa_Kho
            // 
            this.txtMa_Kho.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtMa_Kho.CheckTextSearched = false;
            this.txtMa_Kho.DisabledForeColor = System.Drawing.Color.Empty;
            this.txtMa_Kho.EmptyIsValid = true;
            this.txtMa_Kho.FieldDisplay = "Ten_Kho";
            this.txtMa_Kho.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtMa_Kho.FoundIsValid = true;
            this.txtMa_Kho.Location = new System.Drawing.Point(108, 3);
            this.txtMa_Kho.MaxLength = 32;
            this.txtMa_Kho.Name = "txtMa_Kho";
            this.txtMa_Kho.OldValue = null;
            this.txtMa_Kho.Size = new System.Drawing.Size(100, 20);
            this.txtMa_Kho.TabIndex = 0;
            this.txtMa_Kho.TableName = "DMKHO";
            this.txtMa_Kho.TextDisplay = this.txtTen_Kho;
            this.txtMa_Kho.UserTextLength = QMVnSoft.AppInstance.TextControlLength.ItemCode;
            this.txtMa_Kho.UserTrimMode = QMVnSoft.AppInstance.TextControlTrimMode.All;
            this.txtMa_Kho.Value = ((object)(resources.GetObject("txtMa_Kho.Value")));
            // 
            // lblMa_Kho
            // 
            this.lblMa_Kho.AutoSize = true;
            this.lblMa_Kho.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblMa_Kho.Location = new System.Drawing.Point(12, 6);
            this.lblMa_Kho.Name = "lblMa_Kho";
            this.lblMa_Kho.Size = new System.Drawing.Size(41, 14);
            this.lblMa_Kho.TabIndex = 108;
            this.lblMa_Kho.Text = "Mã kho";
            // 
            // FormVCD02LViewer
            // 
            this.CheckDetailMost = true;
            this.ClientSize = new System.Drawing.Size(794, 534);
            this.Name = "FormVCD02LViewer";
            this.rptContainer.Panel1.ResumeLayout(false);
            this.rptContainer.Panel1.PerformLayout();
            this.rptContainer.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        protected override void OnGenerateColumns()
        {
            object[][] objArray = new object[7][];
            object[] objArray2 = new object[4];
            objArray2[0] = "Ma_Vt";
            objArray2[1] = "Mã vật tư";
            objArray2[2] = "C";
            objArray[0] = objArray2;
            object[] objArray3 = new object[4];
            objArray3[0] = "Ten_Vt";
            objArray3[1] = "Tên vật tư";
            objArray3[2] = "C";
            objArray[1] = objArray3;
            object[] objArray4 = new object[4];
            objArray4[0] = "Dvt";
            objArray4[1] = "Đơn vị tính";
            objArray4[2] = "C";
            objArray[2] = objArray4;
            object[] objArray5 = new object[4];
            objArray5[0] = "Lo_Hang";
            objArray5[1] = "Lô hàng";
            objArray5[2] = "C";
            objArray[3] = objArray5;
            object[] objArray6 = new object[4];
            objArray6[0] = "Han_Dung";
            objArray6[1] = "Hạn dùng";
            objArray6[2] = "D";
            objArray[4] = objArray6;
            objArray[5] = new object[] { "Ton_Cuoi", "Tồn kho", "N", AppInstance.TextNumericFormat.Quantity };
            objArray[6] = new object[] { "Du_Cuoi", "Số dư", "N", AppInstance.TextNumericFormat.LocalAmount };
            base.LocalColNames = objArray;
            base.OnGenerateColumns();
        }

        protected override void OnMakeReport()
        {
            AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct1.Value;
            base.LocalTable = new ReportDataAccess().VCD02L_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtMa_Kho.Value, this.txtMa_Nh_Vt.Value, this.txtMa_Vt.Value, AppInstance.DefLanguage);
            base.OnMakeReport();
        }

        protected override void OnSendParameters()
        {
            base.StimulReport["Ngay"] = "Đến ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct1.Value);
            if (string.IsNullOrEmpty(this.txtMa_Kho.Value.ToString()))
            {
                base.StimulReport["Kho"] = "";
            }
            else
            {
                base.StimulReport["Kho"] = string.Concat(new object[] { "Kho: ", this.txtTen_Kho.Value, " (", this.txtMa_Kho.Value, ")" });
            }
            if (string.IsNullOrEmpty(this.txtMa_Nh_Vt.Value.ToString()))
            {
                base.StimulReport["NhomVatTu"] = "";
            }
            else
            {
                base.StimulReport["NhomVatTu"] = string.Concat(new object[] { "Nhóm vật tư: ", this.txtTen_Nh_Vt.Value, " (", this.txtMa_Nh_Vt.Value, ")" });
            }
            if (string.IsNullOrEmpty(this.txtMa_Vt.Value.ToString()))
            {
                base.StimulReport["VatTu"] = "";
            }
            else
            {
                base.StimulReport["VatTu"] = string.Concat(new object[] { "Vật tư: ", this.txtTen_Vt.Value, " (", this.txtMa_Vt.Value, ")" });
            }
        }
    }
}

